package com.bw.dao;

import com.bw.bean.Emp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpDao {

    //1.1按照第二大类交易额展示饼状图
    @Select("select \n" +
            "b2.name,\n" +
            "sum(o.final_total_amount) value\n" +
            " from order_info o\n" +
            "LEFT JOIN order_detail d ON d.order_id=o.id\n" +
            "LEFT JOIN sku_info s on d.sku_id=s.id\n" +
            "LEFT JOIN base_category3 b3 ON s.category3_id=b3.id\n" +
            "LEFT JOIN base_category2 b2 ON b3.category2_id=b2.id\n" +
            "where b2.name is not null\n" +
            "group by b2.name ")
    List<Emp> getList1();

    //1.2按品牌交易额 展示柱状图
    @Select("select \n" +
            "b.name,\n" +
            "sum(o.final_total_amount) value\n" +
            " from order_info o\n" +
            "LEFT JOIN order_detail d ON d.order_id=o.id\n" +
            "LEFT JOIN sku_info s on d.sku_id=s.id\n" +
            "LEFT JOIN base_trademark b ON s.tm_id=b.id\n" +
            "where b.name is not null\n" +
            "group by b.name")
    List<Emp> getList2();
    //1.3总成交金额的 数字翻牌展示
    @Select("select \n" +
            "p.spu_name `name`,\n" +
            "sum(o.final_total_amount) value\n" +
            " from order_info o\n" +
            "LEFT JOIN order_detail d ON d.order_id=o.id\n" +
            "LEFT JOIN sku_info s on d.sku_id=s.id\n" +
            "LEFT JOIN spu_info p ON s.spu_id=p.id\n" +
            "where p.spu_name is not null\n" +
            "group by p.spu_name")
    List<Emp> getList3();

    //1.4按SPU 分组，订单金额  轮播表格展示
    @Select("CALL getZon()")
    Double getList4();
}
